package com.lsh.controller;

import com.lsh.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：LiuShihao
 * @date ：Created in 2021/3/12 11:54 上午
 * @desc ：
 */
@Slf4j
@RequestMapping("/test")
@RestController
public class TestController {



    @GetMapping("/testGet1")
    public String testGet1(String name){
        System.out.println("testGet1-name:"+name );
        return "testGet1:"+name;
    }

    /**
     * http://localhost:8081/spring-data/test/testGet3?name=ls
     * @param name
     * @return
     */
    @GetMapping("/testGet3")
    public String testGet3(@RequestParam("name1") String name){
        System.out.println("testGet1-name:"+name );
        return "testGet1:"+name;
    }

    /**
     * http://localhost:8081/spring-data/test/testGet2/1
     * @param id
     * @return
     */
    @GetMapping("/testGet2/{id}")
    public String testGet2(@PathVariable("id") String id){
        System.out.println("testGet2-name:"+id );
        return "testGet2:"+id;
    }

    @PostMapping("/testPost1")
    public String testPost1(User user){
        System.out.println("testPost1-user:"+user );
        return "testPost1:"+user;
    }
    @PostMapping("/testPost2")
    public String testPost2(@RequestBody User user){
        System.out.println("testPost1-user:"+user );
        return "testPost1:"+user;
    }



}
